Mapsend: support icon #'s above 26.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 23 Feb 2003 23:08:00 +0000 (23:08 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 23 Feb 2003 23:08:00 +0000 (23:08 +0000)
GPX: Don't trigger on names of travel bugs.

gpsbabel/gpx.c
gpsbabel/mapsend.c

index dd2b7d725c9b3b2ac8e96d4b13ddda273f1c08de..2cc3aa55b42c73afa3f5144dc65a91fb4a9fab1f 100644 (file)
@@ -40,6 +40,7 @@ static int in_gs_diff;
 static int in_gs_terr;
 static int in_gs_log;
 static int in_gs_log_wpt;
+static int in_gs_tbugs;
 static int in_something_else;
 static xml_tag *cur_tag;
 static char *cdatastr;
@@ -340,6 +341,11 @@ gpx_start(void *data, const char *el, const char **attr)
                in_something_else++;
                start_something_else( el, attr );
        }
+       else if (strcmp(el, "groundspeak:travelbugs") == 0) {
+               in_gs_tbugs++;
+               in_something_else++;
+               start_something_else( el, attr );
+       } 
        else if (in_wpt) {
                in_something_else++;
                start_something_else( el, attr );
@@ -403,11 +409,11 @@ gpx_end(void *data, const char *el)
 {
        float x;
        if (in_cdata) {
-               if (in_name && in_wpt) {
+               if (in_name && in_wpt && !in_gs_tbugs) {
                        wpt_tmp->shortname = xstrdup(cdatastr);
                }
                if (gsshortnames) {
-                       if (in_gs_name && in_wpt) {
+                       if (in_gs_name && in_wpt && !in_gs_tbugs) {
                                wpt_tmp->notes = xstrdup(cdatastr);
                        }
                } else {
@@ -515,6 +521,10 @@ gpx_end(void *data, const char *el)
                in_gs_log_wpt--;
                in_something_else--;
                end_something_else();
+       } else if (strcmp(el, "groundspeak:travelbugs") == 0) {
+               in_gs_tbugs--;
+               in_something_else--;
+               end_something_else();
        } else if (in_wpt) {
                in_something_else--;
                end_something_else();
index 0ced00cd4c9a534c90fad2a1180ebf7d24cdb55d..655a4deef057227ce4b379e59e340407399a8bd2 100644 (file)
@@ -229,7 +229,11 @@ mapsend_wpt_read(void)
                wpt_tmp->position.altitude.altitude_meters = wpt_alt;
                wpt_tmp->position.latitude.degrees = -wpt_lat;
                wpt_tmp->position.longitude.degrees = wpt_long;
-               sprintf(tbuf, "%c", wpt_icon + 'a');
+
+               if (wpt_icon < 26)
+                       sprintf(tbuf, "%c", wpt_icon + 'a');
+               else
+                       sprintf(tbuf, "a%c", wpt_icon - 27 + 'a');
                wpt_tmp->icon_descr = mag_find_descr_from_token(tbuf);
 
                waypt_add(wpt_tmp);
@@ -340,7 +344,11 @@ n = ++cnt;
 
        if (waypointp->icon_descr) {
                iconp = mag_find_token_from_descr(waypointp->icon_descr);
-               n = iconp[0] - 'a';
+               if (1 == strlen(iconp)) {
+                       n = iconp[0] - 'a';
+               } else {
+                       n = iconp[1] - 'a' + 27;
+               }
        } else  {
                n = 0;
        }